package Text2;

/*
 *@Student 张策
 */
public class work2 {
    public static void main(String[] args) throws InterruptedException {
        T t = new T();
        Thread thread = new Thread(t);
        thread.start();
        T.sleep(10000);
        t.setLoop(false);
    }
}
class T extends Thread{
    boolean loop=true;
    int i=0;

    public void setLoop(boolean loop) {
        this.loop = loop;
    }

    @Override
    public void run() {
        while (loop){
            System.out.println("zc666"+"+"+(++i));
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
